package com.wmlive.hhvideo.widget.dialog;

import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import cn.wmlive.hhvideo.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 警告对话框（确定与取消）
 * Created by admin on 2017/5/26.
 */

public class WarnMessageDialog extends BaseDialog {

    @BindView(R.id.tv_warn_title)
    TextView tv_warn_title;
    @BindView(R.id.tv_warn_message)
    TextView tv_warn_message;


    public WarnMessageDialog(Context context) {
        super(context);
        setContentView(R.layout.warm_dialog_layout);
        ButterKnife.bind(this);

        setCancelable(false);
        setCanceledOnTouchOutside(false);
        Log.e("dialog_text","------------WarnMessageDialog-----------");
    }

//    @Override
//    protected void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.warm_dialog_layout);
//        ButterKnife.bind(this);
//        Log.e("dialog_text","------------onCreate-----------");
//    }
    public void setDialogTitleText(String title){
        if(TextUtils.isEmpty(title)){
            tv_warn_title.setVisibility(View.GONE);
        }else {
            tv_warn_title.setText(title);
            tv_warn_title.setVisibility(View.VISIBLE);
        }
    }
    public void setDialogTitleText(int title){
        if(title<=0){
            tv_warn_title.setVisibility(View.GONE);
        }else {
            tv_warn_title.setText(mContext.getText(title));
            tv_warn_title.setVisibility(View.VISIBLE);
        }
    }
    public void setDialogMessageText(String message){
        if(TextUtils.isEmpty(message)){
            tv_warn_message.setVisibility(View.GONE);
        }else {
            tv_warn_message.setText(message);
            tv_warn_message.setVisibility(View.VISIBLE);
        }
    }
    public void setDialogMessageText(int message){
        if(message<=0){
            tv_warn_message.setVisibility(View.GONE);
        }else {
            tv_warn_message.setText(mContext.getText(message));
            tv_warn_message.setVisibility(View.VISIBLE);
        }
    }
    @OnClick(R.id.ll_dialog_warn_cancle)
    public void onClickCancle(){
        if(mBaseDialogOnclicklistener!=null){
            mBaseDialogOnclicklistener.onCancleClick(this);
        }
    }
    @OnClick(R.id.ll_dialog_warn_ok)
    public void onClickOk(){
        if(mBaseDialogOnclicklistener!=null){
            mBaseDialogOnclicklistener.onOkClick(this);
        }

    }
}
